import { axios } from '@/utils/request'

/**
 * 查询公告列表
 * @param query
 * @returns {*}
 */
export function pageNotice(query) {
  return axios({
    url: '/system/notice/page',
    method: 'get',
    params: query
  })
}

/**
 * 获取当前用户收到的公告
 * @param query
 * @returns {*}
 */
export function listByUser(query) {
  return axios({
    url: '/system/notice/listByUser',
    method: 'get',
    params: query
  })
}

/**
 * 查询公告详细
 * @param noticeId
 * @returns {*}
 */
export function getNotice(noticeId) {
  return axios({
    url: '/system/notice/' + noticeId,
    method: 'get'
  })
}

/**
 * 新增公告
 * @param data
 * @returns {*}
 */
export function addNotice(data) {
  return axios({
    url: '/system/notice',
    method: 'post',
    data: data
  })
}

/**
 * 修改公告
 * @param data
 * @returns {*}
 */
export function updateNotice(data) {
  return axios({
    url: '/system/notice',
    method: 'put',
    data: data
  })
}

/**
 * 删除公告
 * @param noticeId
 * @returns {*}
 */
export function delNotice(noticeId) {
  return axios({
    url: '/system/notice/' + noticeId,
    method: 'delete'
  })
}

/**
 * 获取我的系统消息
 * @param query
 * @returns {*}
 */
export function getMyNoticeSend(query) {
  return axios({
    url: '/system/noticeSend/getMyNoticeSend',
    method: 'get',
    params: query
  })
}

/**
 * 用户公告已读
 * @param sendIds
 * @returns {*}
 */
export function readNotice(sendIds) {
  return axios({
    url: '/system/noticeSend/read/' + sendIds,
    method: 'put'
  })
}

/**
 * 删除我的系统消息
 * @param sendIds
 * @returns {*}
 */
export function delMyNotice(sendIds) {
  return axios({
    url: '/system/noticeSend/' + sendIds,
    method: 'delete'
  })
}
